package flc.ast.dialog;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.lxj.xpopup.core.AttachPopupView;

import flc.ast.R;


public class RecordMoreDialog extends AttachPopupView implements View.OnClickListener {
    public RecordMoreDialog(@NonNull Context context) {
        super(context);
    }

    @Override
    protected int getImplLayoutId() {
        return R.layout.dialog_record_more;
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        TextView rename = findViewById(R.id.tvRecordRename);
        TextView share = findViewById(R.id.tvRecordShare);
        TextView delete = findViewById(R.id.tvRecordDelete);
        rename.setOnClickListener(this);
        share.setOnClickListener(this);
        delete.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.tvRecordRename:
                dismiss();
                if (listener != null) {
                    listener.onClickRename();
                }
                break;
            case R.id.tvRecordShare:
                dismiss();
                if (listener != null) {
                    listener.onClickShare();
                }
                break;
            case R.id.tvRecordDelete:
                dismiss();
                if (listener != null) {
                    listener.onClickDelete();
                }
                break;
        }
    }

    private IListener listener;

    public void setListener(IListener listener) {
        this.listener = listener;
    }

    public interface IListener {
        void onClickRename();
        void onClickShare();
        void onClickDelete();
    }

}
